Skip to content

Add prover binary#875

Closed
GraDKh wants to merge 1 commit intogordon/dd_save_commandfrom
dgordon/add_prover_binary
Closed

Add prover binary#875
GraDKh wants to merge 1 commit intogordon/dd_save_commandfrom
dgordon/add_prover_binary

Conversation

@GraDKh
Copy link
Copy Markdown
Contributor

@GraDKh GraDKh commented Aug 29, 2025

TL;DR

Added a standalone prover binary example that can generate proofs from serialized constraint systems and witnesses.

What changed?

  • Added a new prover example binary that reads a constraint system and witness data from disk and produces a serialized proof
  • Implemented a From<ValuesData<'a>> trait for Vec<Word> to simplify conversion of witness data
  • Updated the examples README with documentation for the new prover binary, including usage instructions
  • Added the binary to the examples crate manifest

How to test?

  1. Generate artifacts from an example circuit:
cargo run --release --example sha256 -- save \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin
  1. Produce a proof using the new prover binary:
cargo run --release --example prover -- \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin \
    --proof-path out/sha256/proof.bin \
    --log-inv-rate 1

Why make this change?

This change enables cross-host proof generation pipelines by providing a standalone binary that can generate proofs from serialized inputs. This is useful for scenarios where the constraint system is generated on one machine but the proof needs to be generated on another, potentially more powerful machine optimized for proving.

Copy link
Copy Markdown
Contributor Author

GraDKh commented Aug 29, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

This was referenced Aug 29, 2025
@GraDKh GraDKh requested review from jadnohra and pepyakin August 29, 2025 16:29
@GraDKh GraDKh marked this pull request as ready for review August 29, 2025 16:29
@GraDKh GraDKh force-pushed the dgordon/add_prover_binary branch from 9362d63 to 75a71f2 Compare September 1, 2025 07:04
@GraDKh GraDKh force-pushed the gordon/dd_save_command branch 2 times, most recently from 0c61270 to 5f45183 Compare September 1, 2025 07:11
@GraDKh GraDKh force-pushed the dgordon/add_prover_binary branch from 75a71f2 to d329051 Compare September 1, 2025 07:11
Comment thread crates/examples/examples/prover.rs Outdated
@GraDKh GraDKh force-pushed the dgordon/add_prover_binary branch from d329051 to f5e580a Compare September 1, 2025 08:45
@GraDKh GraDKh force-pushed the gordon/dd_save_command branch from 5f45183 to 06a3624 Compare September 1, 2025 08:45
Comment thread crates/examples/examples/prover.rs Outdated
Comment thread crates/examples/examples/prover.rs Outdated
@GraDKh GraDKh force-pushed the dgordon/add_prover_binary branch from f5e580a to a5c74d3 Compare September 1, 2025 08:53
@GraDKh GraDKh force-pushed the gordon/dd_save_command branch from 06a3624 to d112b72 Compare September 1, 2025 08:53
Copy link
Copy Markdown
Contributor

@jadnohra jadnohra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits, pre-approved

Copy link
Copy Markdown
Contributor Author

GraDKh commented Sep 1, 2025

Addressed both

@GraDKh GraDKh force-pushed the dgordon/add_prover_binary branch from a5c74d3 to 3eeb7cf Compare September 1, 2025 09:15
Comment on lines +88 to +93
if let Some(parent) = args.proof_path.parent()
&& !parent.as_os_str().is_empty()
{
fs::create_dir_all(parent)
.with_context(|| format!("Failed to create parent directory {}", parent.display()))?;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parent.as_os_str().is_empty() check is unnecessary here. When Path::parent() returns Some(parent), the parent path is never empty - it would return None for a path with no parent component. The condition can be simplified to:

if let Some(parent) = args.proof_path.parent() {
    fs::create_dir_all(parent)
        .with_context(|| format!("Failed to create parent directory {}", parent.display()))?;
}

This maintains the same behavior while removing the redundant check.

Suggested change
if let Some(parent) = args.proof_path.parent()
&& !parent.as_os_str().is_empty()
{
fs::create_dir_all(parent)
.with_context(|| format!("Failed to create parent directory {}", parent.display()))?;
}
if let Some(parent) = args.proof_path.parent()
{
fs::create_dir_all(parent)
.with_context(|| format!("Failed to create parent directory {}", parent.display()))?;
}

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@jadnohra jadnohra force-pushed the dgordon/add_prover_binary branch from 3eeb7cf to dfbed87 Compare September 1, 2025 22:35
@jadnohra jadnohra force-pushed the gordon/dd_save_command branch from d112b72 to 5886785 Compare September 1, 2025 22:35
This was referenced Sep 1, 2025
@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Sep 2, 2025

Merge activity

  • Sep 2, 7:12 AM UTC: GraDKh added this pull request to the Graphite merge queue.
  • Sep 2, 7:13 AM UTC: CI is running for this pull request on a draft pull request (#908) due to your merge queue CI optimization settings.
  • Sep 2, 7:20 AM UTC: Merged by the Graphite merge queue via draft PR: #908.

graphite-app bot pushed a commit that referenced this pull request Sep 2, 2025
### TL;DR

Added a standalone prover binary example that can generate proofs from serialized constraint systems and witnesses.

### What changed?

- Added a new `prover` example binary that reads a constraint system and witness data from disk and produces a serialized proof
- Implemented a `From<ValuesData<'a>>` trait for `Vec<Word>` to simplify conversion of witness data
- Updated the examples README with documentation for the new prover binary, including usage instructions
- Added the binary to the examples crate manifest

### How to test?

1. Generate artifacts from an example circuit:

```
cargo run --release --example sha256 -- save \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin
```

1. Produce a proof using the new prover binary:

```
cargo run --release --example prover -- \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin \
    --proof-path out/sha256/proof.bin \
    --log-inv-rate 1
```

### Why make this change?

This change enables cross-host proof generation pipelines by providing a standalone binary that can generate proofs from serialized inputs. This is useful for scenarios where the constraint system is generated on one machine but the proof needs to be generated on another, potentially more powerful machine optimized for proving.
@graphite-app graphite-app bot closed this Sep 2, 2025
@graphite-app graphite-app bot deleted the dgordon/add_prover_binary branch September 2, 2025 07:20
lockedloop pushed a commit that referenced this pull request Sep 8, 2025
### TL;DR

Added a standalone prover binary example that can generate proofs from serialized constraint systems and witnesses.

### What changed?

- Added a new `prover` example binary that reads a constraint system and witness data from disk and produces a serialized proof
- Implemented a `From<ValuesData<'a>>` trait for `Vec<Word>` to simplify conversion of witness data
- Updated the examples README with documentation for the new prover binary, including usage instructions
- Added the binary to the examples crate manifest

### How to test?

1. Generate artifacts from an example circuit:

```
cargo run --release --example sha256 -- save \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin
```

1. Produce a proof using the new prover binary:

```
cargo run --release --example prover -- \
    --cs-path out/sha256/cs.bin \
    --pub-witness-path out/sha256/public.bin \
    --non-pub-data-path out/sha256/non_public.bin \
    --proof-path out/sha256/proof.bin \
    --log-inv-rate 1
```

### Why make this change?

This change enables cross-host proof generation pipelines by providing a standalone binary that can generate proofs from serialized inputs. This is useful for scenarios where the constraint system is generated on one machine but the proof needs to be generated on another, potentially more powerful machine optimized for proving.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants